package com.yt.app.provider.service.impl;

import com.yt.app.core.interfaces.ActivityUserService;
import com.yt.app.core.model.Activity;
import com.yt.app.core.model.ActivityUser;
import com.yt.app.provider.dao.ActivityDao;
import com.yt.app.provider.dao.ActivityUserDao;
import com.yt.core.service.GenericServiceImpl;

public class ActivityUserServiceImpl extends GenericServiceImpl<ActivityUser, Long> implements ActivityUserService {
	private ActivityUserDao dao;
	private ActivityDao activityDao;

	public ActivityDao getActivityDao() {
		return activityDao;
	}

	public void setActivityDao(ActivityDao activityDao) {
		this.activityDao = activityDao;
	}

	public ActivityUserServiceImpl() {
	}

	public ActivityUserServiceImpl(ActivityUserDao dao) {
		super(dao);
		this.dao = dao;
	}

	@Override
	public void insertUser(ActivityUser activityUser) {
		this.dao.insert(activityUser);
		this.activityDao.increaseUserCount(activityUser.getActivityId());
	}
}
